import 'package:flutter/material.dart';
import '../../models/order_detail_model.dart';
import '../../l10n/app_localizations.dart';

class OrderPopView extends StatelessWidget {
  final Function(String) gotoDetail;
  final Function(String) gotoShouyitai;
  final Function() close;
  final DetailInfoModel order;

  OrderPopView({
    required this.gotoDetail,
    required this.gotoShouyitai,
    required this.close,
    required this.order,
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      child: Container(
        color: Colors.black.withValues(alpha: 0.4),
        child: Center(
          child: Container(
            width: 320,
            height: 335,
            decoration: BoxDecoration(
              image: DecorationImage(
                image: AssetImage('assets/images/orderpop2.png'),
                fit: BoxFit.cover,
              ),
              borderRadius: BorderRadius.circular(15),
            ),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                SizedBox(
                  height: 59,
                  child: Stack(
                    fit: StackFit.expand,
                    clipBehavior: Clip.none,
                    children: [
                      Positioned(
                        top: -34,
                        left: 125,
                        child: Image.asset('assets/images/orderpop1.png', width: 69, height: 69),
                      ),
                      Positioned(
                        top: 5,
                        right: 5,
                        child: IconButton(
                          icon: Icon(Icons.close),
                          onPressed: () => close(),
                        ),
                      ),
                    ],
                  ),
                ),
                Text(
                  AppLocalizations.of(context)!.warmTips,
                  style: TextStyle(fontSize: 17, color: Colors.black,fontWeight: FontWeight.bold),
                ),
                SizedBox(height: 17),
                Text(
                  AppLocalizations.of(context)!.orderUnpaidAlert,
                  style: TextStyle(fontSize: 14, color: Colors.black),
                ),
                SizedBox(height: 10),
                Text(
                  "${order.symbol}${order.couponsPrice} ${AppLocalizations.of(context)!.coupon}",
                  style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold, color: Colors.black),
                ),
                SizedBox(height: 10),
                Text(
                  AppLocalizations.of(context)!.orderRecommendation,
                  style: TextStyle(fontSize: 14, color: Colors.black),
                ),
                SizedBox(height: 15),
                GestureDetector(
                  onTap: () => gotoShouyitai(order.orderId),
                  child: Container(
                    width: isChineseLocale() ? 185 : 210,
                    height: 40,
                    decoration: BoxDecoration(
                      color: Color(0xFF5F60EF),
                      borderRadius: BorderRadius.circular(20),
                    ),
                    child: Center(
                      child: Text(
                        AppLocalizations.of(context)!.changePaymentMethod,
                        style: TextStyle(fontSize: 15, color: Colors.white),
                      ),
                    ),
                  ),
                ),
                SizedBox(height: 18),
                GestureDetector(
                  onTap: () => gotoDetail(order.orderId),
                  child: Container(
                    width: isChineseLocale() ? 185 : 210,
                    height: 40,
                    decoration: BoxDecoration(
                      border: Border.all(color: Color(0xFF5F60EF)),
                      borderRadius: BorderRadius.circular(20),
                    ),
                    child: Center(
                      child: Text(
                        AppLocalizations.of(context)!.cancelOrderAndRefund,
                        style: TextStyle(fontSize: 15, color: Color(0xFF5F60EF)),
                      ),
                    ),
                  ),
                ),
                SizedBox(height: 22),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
